package Dispatch;

import HttpBean.Request.Request;
import HttpBean.Response.Response;

public abstract class HttpHandle {
    HttpHandle handle;
    public HttpHandle setNext(HttpHandle handle){
        this.handle = handle;
        return handle;
    }
    public final Response resolve(Request request){
        Response response;
        if((response = doResolve(request)) != null){
            return response;
        }else if(handle != null){
            return handle.resolve(request);
        }else {
            return null;
        }
    }
    protected abstract Response doResolve(Request request);
}
